<%@ page language="java" pageEncoding="UTF-8"%>
<%@ page import="java.util.*" %>
<%@ page import="com.yztc.rc.api.framework.manager.UserManager" %>
<%@ page import="com.yztc.rc.api.framework.entity.UserAccount" %>
<%@ page import="net.ssta.common.DataBaseConfig" %>
<%@ page import="net.ssta.core.db.RecordSet"%>
<%@ page import="net.ssta.core.db.Record"%>
<%@ page import="orest.back.membermanage.RegisterUserHandler"%>
<%@ page import="net.ssta.util.bill.UserPoint" %>
<%
	String path = request.getContextPath();
    String userId=request.getParameter("userId");
    String flag=request.getParameter("flag");
    RecordSet rs=UserPoint.getIpConfig(userId);
    if(rs==null){
    	rs=new RecordSet();
    }
    
%>



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>


<link type="text/css" rel="stylesheet" href="<%=path %>/includes/css/commonStyle.css"/> 
<link type="text/css" rel="stylesheet" href="<%=path %>/includes/styleBase/css/styleBase.css"/>
<link type="text/css" rel="stylesheet" href="<%=path %>/includes/styleBase/css/ostable.css" />
<link type="text/css" rel="stylesheet" href="<%=path %>/includes/styleBase/css/tab.css" />



<script type='text/javascript' src="<%=path %>/includes/FusionCharts/js/FusionCharts.js"></script>
<script type='text/javascript' src="<%=path %>/includes/FusionCharts/js/FusionChartsExportComponent.js"></script>

<script type='text/javascript' src="<%=path %>/includes/js/jquery.js"></script>
<script type="text/javascript" src="<%=path %>/includes/styleBase/js/style.js"></script>
<script type="text/javascript" src="<%=path %>/includes/DatePicker/WdatePicker.js"></script>


<script type="text/javascript" src="<%=path %>/includes/lhgdialog/lhgcore.min.js"></script>
<script type="text/javascript" src="<%=path %>/includes/lhgdialog/lhgdialog.js"></script>

<script type="text/javascript" src="<%=path %>/includes/Fvalidate/Fvalidate.js" ></script>
<link type="text/css" rel="stylesheet" href="<%=path %>/includes/Fvalidate/style.css" />

 
<title>充值</title>
 
<script type="text/javascript">

var dg = frameElement.dg;

$(document).ready(function()
{
    dg.addBtn( 'save', '保存', save );
	dg.addBtn( 'cancel', '取消', cancel );
	$("#searchFrom").Fvalidate({live:true});
	if("<%=flag%>"=="true"){
	    alert("IP设置成功!");
	    dg.cancel();
	  
	}
});
 
function cancel()
{
  dg.cancel();
}

function save()
{
	document.pwdFrom.submit();
}
 
 function addIp(){
    var td="<tr><td><input name='IP' type='text'/><input name='IPEND' type='hidden'/></td></tr>";
    $("#ipTable").append(td);
 }
 
  function addIpRange(){
    var td="<tr><td><input name='IP' type='text'/>&nbsp;&nbsp;到&nbsp;&nbsp;<input name='IPEND' type='text'/></td></tr>";
    $("#ipTable").append(td);
 }
</script>



<style>
body, html {
	margin:0;
	padding:0;
}
	.ctable{
		font-size:12px;
		cellPadding:0px;
		cellSpacing:0px;
		background-color:#F6F9FF;
		
		} 
 
		.ctable tr{
		height:24px; 
		} 
		.ctable tr td{ 
		border:0px;
		border-top:1px #99bbe8 solid; 
		border-right:1px #99bbe8 solid;
		padding:5px; 
		vertical-align:middle;
		}
</style>


</head>
<body>
<form id="searchFrom" action="<%=path %>/back/userPointManager?method=ipConfig"  name="pwdFrom" method="post">
<input type="hidden"  maxlength="20" style="width:120px;" class="textInput" value="<%=userId %>" name="userId"/>

<div class="multiEditPanel" style="border:0;padding:10px;width:90%;padding-left:20px;">
  <table cellpadding="0" id="ipTable" align="center" cellspacing="0" border="0" class="ctable" style="border-left:1px solid #99bbe8;border-bottom:1px solid #99bbe8;border-right:0px solid red;">
    <tr >
      <td width="15%" ><input type="button" value="增加IP" onclick="addIp()"/>&nbsp;<input type="button" value="增加IP段" onclick="addIpRange()"/>&nbsp;&nbsp;&nbsp;&nbsp;请按IP地址的正确写法填写，如192.168.1.122</td>
     </tr>
     
     <%
        for(int i=0;i<rs.size();i++){
        	Record r=rs.get(i);
	 %>
	  <tr >
	  <td>
	   <input name='IP' type='text' value="<%=r.getString("IP","") %>"/> 
	   <%if("".equals(r.getString("IPEND",""))){ %>
	   		<input name='IPEND' type='hidden'/>
	   <%}else{ %>
	    	&nbsp;&nbsp;到&nbsp;&nbsp;<input name='IPEND' type='text' value="<%=r.getString("IPEND","") %>"/>
	   <%} %>
	  </td>
	  </tr>
	 
	 <%  
        	
        }
     %>
  </table>
</div>
</form>
</body> 
</html>